<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>10</title>
</head>
<body>
<script>
    //编程找出四位整数abcd中满足下述关系的数,
    // (ab+cd)*(ab+cd)=abcd（例如：(20 + 25) (20 + 25)= 2025）,
    // 并统计满足条件的数的个数,求出所有满足条件的数的和
    var sum=0;
    var count=0;
    for (let abcd = 1000; abcd <=9999; abcd++) {
        var ab=parseInt(abcd/100);
        var cd=parseInt(abcd%100);
        if (Math.pow((ab+cd),2)==abcd){
            count++;
            sum+=abcd;
        }
    }
    console.log("满足条件的数的个数为:"+count);
    console.log("满足条件的数的和为:"+sum);
</script>
</body>
</html>